import React, { Component } from 'react';
import { View, Text, TouchableOpacity, Image,TextInput } from 'react-native';

import Icon from 'react-native-vector-icons/Ionicons'

class DetailItem extends Component {
    state = {};

    componentDidMount() {


    }

    moneyText=() =>{

        if(this.props.rowData.id == 22){
          return <TextInput style={{color:'red',textAlign:'right',marginRight:10}}
              onChangeText={(text) => this.props.onTextChangeText(text)}
            //   value={this.props.rowData.text}
              keyboardType='numeric'
              placeholder='请输入金额'
              underlineColorAndroid='transparent'
          />
        }
        return null;

    }

    render() {
        let rowData = this.props.rowData;
        return (
            <TouchableOpacity
            onPress={() => this.props.itemClick(this.props.rowData)}
            disabled = {this.props.status === '1'? true:false}
            >
                <View flexDirection='row'
                    style={{ padding: 10, alignItems: 'center',backgroundColor:'white',borderBottomColor:'gray',borderBottomWidth:0.5 }}
                >
                    <Image source={{ uri: rowData.icon }}
                        style={{ marginRight: 8 ,width:20,height:30}}
                    />
                    <Text>{rowData.name}</Text>
                    <View style={{ flex: 1, alignItems: 'center',justifyContent:'flex-end',flexDirection:'row' }}>
                         {this.moneyText()}
                        <Text style={{color:rowData.color}}>{rowData.placeHolder}</Text>
                        <Icon style={{marginLeft:10}} name='ios-arrow-forward' size={30} />
                    </View>
                </View>
            </TouchableOpacity>
        );
    }
}

export default DetailItem;
